package msu.ml.core.xml;

import msu.ml.core.*;
import msu.ml.data.*;
import weka.classifiers.*;
import java.util.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;

/**
 * @author Reginald M Mead
 * @version 1.0
 */
public class ExperimentXmlParserFactory
{
    public ExperimentXmlParser createParser()
    {
        ExperimentXmlParser parser = new ExperimentXmlParser();

        //Add Data Loader Parsers
        parser.addDataLoaderParser("level_2_data_loader", 
                new Level2DataLoaderParser());
        parser.addDataLoaderParser("arff_data_loader", 
                new ArffDataLoaderParser());

        //Add Preprocessor Parsers
        parser.addPreProcessorParser("attribute_removal_pre_processor",
                new AttributeRemovalPreProcessorParser());
        parser.addPreProcessorParser("absolute_value",
                new AbsoluteValuePreProcessorParser());
        parser.addPreProcessorParser("discretization_pre_processor",
                new DiscretizationPreProcessorParser());
        parser.addPreProcessorParser("subsample_pre_processor",
                new SubsamplePreProcessorParser());

        //Add Data Provider Parsers
        parser.addDataProviderParser("cross_validation_data_provider",
                new CrossValidationDataProviderParser());
        parser.addDataProviderParser("manual_validation_data_provider",
                new ManualValidationDataProviderParser());
        parser.addDataProviderParser("dbcv_data_provider",
                new DbcvDataProviderParser());

        //Add Classifier Parsers
        parser.addClassifierParser("multilayer_perceptron",
                new MultilayerPerceptronParser());
        parser.addClassifierParser("support_vector_machine",
                new SupportVectorMachineParser());
        parser.addClassifierParser("k_nearest_neighbor",
                new KNearestNeighborParser());
        parser.addClassifierParser("naive_bayes",
                new NaiveBayesParser());
        parser.addClassifierParser("j48",
                new DecisionTreeParser());

        //Add Postprocessor Parsers
        ValidationPostProcessorParser validationParser = 
                new ValidationPostProcessorParser();
        validationParser.addClassificationRuleParser("majority_rule",
                new MajorityRuleParser());
        validationParser.addClassificationRuleParser("threshold_rule",
                new ThresholdRuleParser());
        parser.addPostProcessorParser("validation_post_processor",
                validationParser);

        parser.addPostProcessorParser("gis_post_processor",
                new GISPostProcessorParser());
        parser.addPostProcessorParser("csv_post_processor",
                new CSVPostProcessorParser());
        parser.addPostProcessorParser("image_post_processor",
                new ImagePostProcessorParser());
        parser.addPostProcessorParser("classifier_serializer_post_processor",
                new ClassifierSerializationPostProcessorParser());
        parser.addPostProcessorParser("confusion_matrix",
                new ConfusionMatrixPostProcessorParser());

        return parser;
    }
}
